package nc.ui.tc.Annualadjustmentschedule;

import java.util.ArrayList;
import java.util.List;

import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;

public class ShowItems {

	public static void showItem(BillCardPanel billCardPanel,String jobcode) {
		List<String> item = new ArrayList<String>();
		String[] items = new String[] { "bzbm", "pk_jobbasfil","tzlb","userdept","tzdh","tzrq","ndfyys","cjr","cjrq","explanation","tzsm","m_year","tzy", "summary",
				"contractno", "borrowdate", "repaymentdate", "capitalmoney",
				"yearinterestratio", "earlyloanbalances", "addcapitalmoney",
				"subcapitalmoney", "loanbalances", "interest", "creater",
				"createdate", "remark" };
		for (int i = 0; i < items.length; i++) {
			item.add(items[i]);
		}
		if("305030201".equals(jobcode))
		{
			item.add("proxytaxrate");
		}

		BillItem[] billItems = billCardPanel.getHeadItems();
		for (int i = 0; i < billItems.length; i++) {
			if (!item.contains(billItems[i].getKey())) {
				billCardPanel.getHeadItem(billItems[i].getKey()).setShow(false);
				billCardPanel.getHeadItem(billItems[i].getKey())
				.getCaptionLabel().setText("");
				billCardPanel.getHeadItem(billItems[i].getKey()).getComponent()
						.setVisible(false);
			}

		}
	}
	
	
	public static void hiddenItem(BillCardPanel billCardPanel) {
		List<String> item = new ArrayList<String>();
		String[] items = new String[] { "summary",
				"contractno", "borrowdate", "repaymentdate", "capitalmoney",
				"yearinterestratio", "earlyloanbalances", "addcapitalmoney",
				"subcapitalmoney", "loanbalances", "interest", "creator",
				"createdate","proxytaxrate"};
		for (int i = 0; i < items.length; i++) {
			item.add(items[i]);
		}

		BillItem[] billItems = billCardPanel.getHeadItems();
		for (int i = 0; i < billItems.length; i++) {
			if (item.contains(billItems[i].getKey())) {
				billCardPanel.getHeadItem(billItems[i].getKey()).setShow(false);
				billCardPanel.getHeadItem(billItems[i].getKey())
						.getCaptionLabel().setText("");
				billCardPanel.getHeadItem(billItems[i].getKey()).getComponent()
						.setVisible(false);
			}

		}
	}
}
